fix: Fix workspace graph caching. Avoid unnecessary plugin calls. - #2602
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves workspace graph caching by making the cache key include more of the inputs that can affect the workspace graph, and by avoiding running graph-extension plugin hooks when the cached graph is reused.
Changes:
- Introduces a toolchain plugin
extend_project_graphimplementation in thetc-tier1WASM test plugin to validate caching behavior and plugin invocation. - Refactors workspace graph cache state/fingerprinting to hash project sources, config/toolchain inputs, environment, and plugin versions, and updates cache state file naming.
- Adds/updates tests to verify cache hit/miss behavior for plugin graph extension and cache invalidation scenarios.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
wasm/tc-tier1/src/lib.rs |
Adds extend_project_graph hook used by tests to validate cache-hit behavior and alias extraction. |
wasm/Cargo.lock |
Updates dependency lockfile versions/checksums for the WASM workspace. |
crates/workspace/src/workspace_cache.rs |
Renames cache state and expands workspace graph fingerprint inputs. |
crates/workspace/src/workspace_builder.rs |
Reworks cache digest generation and plugin extension flow for the workspace graph. |
crates/project-graph/tests/project_graph_test.rs |
Updates cache state assertions and adds new plugin caching/invalidation tests. |
crates/app/src/watchers/workspace_watcher.rs |
Updates watcher cleanup to remove the new cache state file. |
.moon/workspace.yml |
Disables asyncGraphBuilding experiment (now commented out). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Run report for 6b36d2a0
|
| Action | Time | Status | Info | |
|---|---|---|---|---|
| 🟩 | SyncWorkspace |
412.9ms | Passed | |
| 🟩 | SyncProject(types) |
5.9ms | Passed | |
| 🟩 | SyncProject(report) |
5.4ms | Passed | |
| 🟩 | SetupProto(0.58.2) |
9.7s | Passed | |
| 🟩 | SetupToolchain(node:22.18.0) |
6.5s | Passed | |
| 🟩 | SetupToolchain(yarn:4.16.0) |
1.2s | Passed | |
| ⬛️ | SetupToolchain(javascript) |
0.3ms | Skipped | |
| 🟩 | SetupEnvironment(javascript) |
3.3ms | Passed | |
| ⬛️ | InstallDependencies(javascript) |
0.9ms | Skipped | |
| 🟩 | RunTask(types:test) |
1.4s | Passed | |
| 🟩 | RunTask(types:typecheck) |
1.5s | Passed | |
| 🟩 | RunTask(types:build) |
1.9s | Passed | |
| 🟩 | RunTask(report:test) |
2.8s | Passed | |
| 🟩 | RunTask(visualizer:test) |
3.2s | Passed | |
| 🟩 | RunTask(visualizer:typecheck) |
3.9s | Passed | |
| 🟩 | RunTask(website:test) |
1.6s | Passed | |
| 🟩 | RunTask(report:build) |
3.3s | Passed | |
| 🟩 | RunTask(report:typecheck) |
2.2s | Passed | |
| 🟩 | RunTask(vscode-extension:typecheck) |
3s | Passed | |
| 🟩 | RunTask(visualizer:build) |
4.5s | Passed | |
| And 4 more... |
Expanded report
| Action | Time | Status | Info | |
|---|---|---|---|---|
| 🟩 | RunTask(vscode-extension:test) |
1.9s | Passed | |
| 🟩 | RunTask(vscode-extension:build) |
2.1s | Passed | |
| 🟩 | RunTask(website:typecheck) |
9.3s | Passed | |
| 🟩 | RunTask(website:build) |
1m 31s | Passed |
Environment
OS: Linux
Matrix:
os = ubuntu-latest
Changed files
.moon/workspace.yml
crates/app/src/watchers/workspace_watcher.rs
crates/project-graph/tests/project_graph_test.rs
crates/workspace/src/workspace_builder.rs
crates/workspace/src/workspace_cache.rs
wasm/Cargo.lock
wasm/tc-tier1/src/lib.rs
Run report for 6b36d2a0
|
| Action | Time | Status | Info | |
|---|---|---|---|---|
| 🟩 | SyncWorkspace |
432.5ms | Passed | |
| 🟩 | SyncProject(types) |
7.1ms | Passed | |
| 🟩 | SyncProject(report) |
6.5ms | Passed | |
| 🟩 | SetupProto(0.58.2) |
9.5s | Passed | |
| 🟩 | SetupToolchain(node:22.18.0) |
9.3s | Passed | |
| 🟩 | SetupToolchain(yarn:4.16.0) |
1.6s | Passed | |
| ⬛️ | SetupToolchain(javascript) |
0.3ms | Skipped | |
| 🟩 | SetupEnvironment(javascript) |
4.3ms | Passed | |
| ⬛️ | InstallDependencies(javascript) |
0.6ms | Skipped | |
| 🟩 | RunTask(types:typecheck) |
2.3s | Passed | |
| 🟩 | RunTask(types:test) |
2.4s | Passed | |
| 🟩 | RunTask(types:build) |
3.3s | Passed | |
| 🟩 | RunTask(visualizer:typecheck) |
5.1s | Passed | |
| 🟩 | RunTask(visualizer:test) |
6.1s | Passed | |
| 🟩 | RunTask(report:build) |
6.7s | Passed | |
| 🟩 | RunTask(website:test) |
3.8s | Passed | |
| 🟩 | RunTask(report:test) |
3.4s | Passed | |
| 🟩 | RunTask(report:typecheck) |
1.2s | Passed | |
| 🟩 | RunTask(vscode-extension:typecheck) |
4.3s | Passed | |
| 🟩 | RunTask(website:typecheck) |
10.8s | Passed | |
| And 4 more... |
Expanded report
| Action | Time | Status | Info | |
|---|---|---|---|---|
| 🟩 | RunTask(visualizer:build) |
7s | Passed | |
| 🟩 | RunTask(vscode-extension:build) |
2.8s | Passed | |
| 🟩 | RunTask(vscode-extension:test) |
2.6s | Passed | |
| 🟩 | RunTask(website:build) |
1m 38s | Passed |
Environment
OS: Windows
Matrix:
os = windows-latest
Changed files
.moon/workspace.yml
crates/app/src/watchers/workspace_watcher.rs
crates/project-graph/tests/project_graph_test.rs
crates/workspace/src/workspace_builder.rs
crates/workspace/src/workspace_cache.rs
wasm/Cargo.lock
wasm/tc-tier1/src/lib.rs
Merging this PR will not alter performance
|
|
Much love for this fix, it's made a huge difference. |
No description provided.